function Sprite()
{
	
	this.position        = Vector2.zero();
	this.scale           = Vector2.one();
	this.sourceRectangle = null;
	
	var _element = document.createElement("img");
	
	this.getElement = function()
	{
		return _element;
	}
	
	this.getURL = function()
	{
		return _element.src;
	}
	
	this.setURL = function(value)
	{
		function onLoadedMETAData()
		{
			if (this.sourceRectangle)
			{
				this.sourceRectangle.x      %= _element.width;
				this.sourceRectangle.y      %= _element.height;
				this.sourceRectangle.width  %= _element.width;
				this.sourceRectangle.height %= _element.height;
			}
			_element.removeEventListener("loadedmetadata", onLoadedMETAData);
		}
		_element.addEventListener("loadedmetadata", onLoadedMETAData);
		_element.src = value;
	}
	
	this.isReady = function()
	{
		return _element.complete;
	}
	
	this.draw = function(context)
	{
		// TEMPORARY
		if (this.sourceRectangle)
			context.drawImage(
				_element,
				Math.round(this.sourceRectangle.x),
				Math.round(this.sourceRectangle.y),
				Math.round(this.sourceRectangle.width),
				Math.round(this.sourceRectangle.height),
				Math.round(this.position.x),
				Math.round(this.position.y),
				Math.round(this.scale.x * this.sourceRectangle.width),
				Math.round(this.scale.y * this.sourceRectangle.height)
			);
		else
			context.drawImage(
				_element,
				Math.round(this.position.x),
				Math.round(this.position.y),
				Math.round(this.scale.x * _element.width),
				Math.round(this.scale.y * _element.height)
			);
	}
	
}